﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
namespace SmartWeb.BLL
{
    /// <summary>
    ///UserFun 的摘要说明
    /// </summary>
    public class UserFun
    {
        public UserFun()
        {
            //
            //TODO: 在此处添加构造函数逻辑
            //
        }

        public static string HtmlToText(string str)
        {
            if (str == null)
            {
                return "";
            }
            else
            {
                str = str.Replace("'", "''");
                str = str.Replace("&nbsp;", " ");
                str = str.Replace("&lt;", "<");
                str = str.Replace("&gt;", ">");
                str = str.Replace("<br/>", "\n");
                str = str.Replace("&nbsp;&nbsp;&nbsp;", "\t");
                return str;
            }
        }
        public static string TextToHtml(string str)
        {
            if (str == null)
            {
                return "";
            }
            else
            {
                str = str.Replace(" ", "&nbsp;");
                str = str.Replace("<", "&lt;");
                str = str.Replace(">", "&gt;");
                str = str.Replace("\n", "<br/>");
                str = str.Replace("\t", "&nbsp;&nbsp;&nbsp;");
                return str;
            }
        }

        public static string getMarker(int pp)
        {
            string cc = "";
            if (pp > 26)
            {
                int m = pp / 26;
                int n = pp % 26;
                cc += m.ToString("00") + n.ToString("00");

            }
            else
            {
                cc = pp.ToString();
            }

            if (cc.Length % 2 == 1)
            {
                cc = "0" + cc;
            }
            string w = "";
            for (int i = 0; i < cc.Length / 2; i++)
            {
                w += ((Letter)Convert.ToInt32(cc.Substring(i * 2, 2))).ToString();
            }
            return w;
        }
        public static string GetWeek(DayOfWeek EnWeek)
        {
            switch (EnWeek)
            {
                case DayOfWeek.Friday:
                    return "星期五";
                case DayOfWeek.Monday:
                    return "星期一";
                case DayOfWeek.Saturday:
                    return "星期六";
                case DayOfWeek.Sunday:
                    return "星期日";
                case DayOfWeek.Thursday:
                    return "星期四";
                case DayOfWeek.Tuesday:
                    return "星期二";
                case DayOfWeek.Wednesday:
                    return "星期三";
                default:
                    return "";
            }
        }


    }



    public enum Letter
    {
        a = 1, b = 2, c = 3, d = 4, e = 5, f = 6, g = 7, h = 8, i = 9, j = 10, k = 11, l = 12, m = 13, n = 14, o = 15, p = 16, q = 17, r = 18, s = 19, t = 20, u = 21, v = 22, w = 23, x = 24, y = 25, z = 26
    }

    public enum CNum
    {
        零 = 0, 一 = 1, 二 = 2, 三 = 3, 四 = 4, 五 = 5, 六 = 6, 七 = 7, 八 = 8, 九 = 9, 十 = 10, 十一 = 11, 十二 = 12, 十三 = 13
    }
}